package cate.game.play.proce.result;

import cate.common.table.d.GDPlay;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass("血量变更结果")
public class HpChangeResult extends ActionResult<HpChangeResult> {

    @NoteField("被暴击")
    public boolean strike;

    @NoteField(value = "改变值")
    public long val;

    @NoteField("改变后的血量")
    public long hp;

    @NoteField("理由")
    public int reason;

    @NoteField("技能性质")
    public byte nature;

    public HpChangeResult() {
        this.type = GDPlay.ResultType.HP_CHANGE;
    }

    public HpChangeResult strikeSet(boolean strike) {
        this.strike = strike;
        return this;
    }

    public HpChangeResult valSet(long val) {
        this.val = val;
        return this;
    }

    public HpChangeResult hpSet(double hp) {
        this.hp = (long) hp;
        return this;
    }

    public HpChangeResult reasonSet(int reason) {
        this.reason = reason;
        return this;
    }

    public HpChangeResult natureSet(byte nature) {
        this.nature = nature;
        return this;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(super.toString());
        sb.append(" " + Math.round(this.val));
        if (this.strike) {
            sb.append("【暴击】");
        }
        return sb.toString();
    }
}
